<%@page import="com.cxh.dao.impl.A_goodsDaoImpl"%>
<%@page import="com.cxh.dao.A_goodsDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
<script type="text/javascript">
    	$(function(){
    		//全选全不选
			$("#checkAll").click(
			  function(){
			   $("input[name='typeId']").prop("checked",this.checked);
			  }
			);
			//query();
		});
    	function query(){
    		$.ajax({
    			cache: false,
				type: "POST",
				url:"a_transferServlet",
				dataType:"json",
				data:$('#pageIndexFrom').serialize(),
				async: false,
				error: function(request) {
					alert("发送请求失败！");
				},
				success:function(data){
					var template=$("#template").html();
					var html=[];
					$("#tbody").html("");
					if(data.list.length > 0){
						$.each(data.list,function(i,ele){
							var tr=template;
							tr=tr.replace(/{transfer_id}/g,ele.transfer_id);
							tr=tr.replace(/{transfer_outman}/,ele.customerList[0].customer_name);
							tr=tr.replace(/{amount_out}/,ele.amount_out);
							tr=tr.replace(/{poundage}/,ele.poundage);
							tr=tr.replace(/{transfer_inman}/,ele.customerList[1].customer_name);
							tr=tr.replace(/{amount_in}/,ele.amount_in);
							tr=tr.replace(/{goods}/,ele.goods.goods_name);
							tr=tr.replace(/{transfer_date}/,ele.transfer_date);
							html.push(tr);
						});
					}else{
						html.push('<tr><td colspan="10" align="center"><font color="red">没有找到数据</font></td></tr>');
					}
					$("#tbody").append(html.join(""));
					$("#pageIndex1").html(data.pageIndex);
					$("#pageCount1").html(data.pageCount);
					$("#pageSize1").html(data.pageSize);
					$("#totalCount1").html(data.totalCount);
					$("#type1").html();
					
				}
			});
    	};
    	function shouye(){
    		$("#pageIndexs").val(1);
    		query();
    	};
    	function shangyiye(){
    		$("#pageIndexs").val(($("#pageIndex1").html()-1)<=0?1:$("#pageIndex1").html()-1);
    		query();
    	}
    	function xiayiye(){
    		var page1 = parseInt($("#pageIndex1").html())+1;
    		var pageCount1 = parseInt($("#pageCount1").html());
    		$("#pageIndexs").val(page1>=pageCount1?pageCount1:page1);
    		query();
    	}
    	function moye(){
    		$("#pageIndexs").val($("#pageCount1").html());
    		query();
    	};
    	function doFind(){
			$.ajax({
				cache: false,
				type: "POST",
				url:"a_transferServlet", 
				dataType:"json",
				data:$('#ajaxFrm').serialize(),
				async: false,
				error: function(request) {
					alert("发送请求失败！");
				},
				success: function(data) { 
					var template=$("#template").html();
					var html=[];
					$("#tbody").html("");
					if(data.list.length>0){
						$.each(data.list,function(i,ele){
							var tr=template;
							tr=tr.replace(/{transfer_id}/g,ele.transfer_id);
							tr=tr.replace(/{transfer_outman}/,ele.customerList[0].customer_name);
							tr=tr.replace(/{amount_out}/,ele.amount_out);
							tr=tr.replace(/{poundage}/,ele.poundage);
							tr=tr.replace(/{transfer_inman}/,ele.customerList[1].customer_name);
							tr=tr.replace(/{amount_in}/,ele.amount_in);
							tr=tr.replace(/{goods}/,ele.goods.goods_name);
							tr=tr.replace(/{transfer_date}/,ele.transfer_date);
							html.push(tr);
						});
					}else{
						html.push('<tr><td colspan="10" align="center"><font color="red">没有找到数据</font></td></tr>');
					}
					
					$("#tbody").append(html.join(""));
					$("#pageIndex1").html(data.pageIndex);
					$("#pageCount1").html(data.pageCount);
					$("#pageSize1").html(data.pageSize);
					$("#totalCount1").html(data.totalCount);
				}
			});
		}
		
		function changepageSize(){
			$("#pageIndexFrom").submit();
		}
    </script>
 <link href="${pageContext.request.contextPath }/assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="${pageContext.request.contextPath }/css/style.css"/>       
        <link href="${pageContext.request.contextPath }/assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/ace.min.css" />
        <link rel="stylesheet" href="${pageContext.request.contextPath }/font/css/font-awesome.min.css" />
        <!--[if lte IE 8]>
		  <link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="${pageContext.request.contextPath }/js/jquery-1.9.1.min.js"></script>
        <script src="${pageContext.request.contextPath }/assets/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="js/H-ui.js"></script>     
		<script src="${pageContext.request.contextPath }/assets/js/typeahead-bs2.min.js"></script>           	
		<%-- <script src="${pageContext.request.contextPath }/assets/js/jquery.dataTables.min.js"></script>
		<script src="${pageContext.request.contextPath }/assets/js/jquery.dataTables.bootstrap.js"></script> --%>
        <script src="${pageContext.request.contextPath }/assets/layer/layer.js" type="text/javascript" ></script>          
        <script src="${pageContext.request.contextPath }/assets/laydate/laydate.js" type="text/javascript"></script>
        <script src="${pageContext.request.contextPath }/assets/js/jquery.easy-pie-chart.min.js"></script>
        <script src="${pageContext.request.contextPath }/js/lrtk.js" type="text/javascript" ></script>
<title>订单管理</title>
</head>

<body>
<div class="margin clearfix">
 <div class="Order_form clearfix" id="Order_form_style">
 <div class="title_name">购物产品所占比例  
     <span class="top_show_btn Statistic_btn">显示</span> 
     <span class="Statistic_title Statistic_btn"><a title="隐藏" class="top_close_btn">隐藏</a></span>
 </div>
 <div class="hide_style clearfix">
   <div class="proportion"> <div class="easy-pie-chart percentage" data-percent="${a }" data-color="#D15B47"><span class="percent" id="type1">${a }</span>%</div><span class="name">科技类</span></div>									
   <div class="proportion"> <div class="easy-pie-chart percentage" data-percent="${a3 }" data-color="#87CEEB"><span class="percent">${a3 }</span>%</div><span class="name">古玩书画类类</span></div>									
   <div class="proportion"> <div class="easy-pie-chart percentage" data-percent="${a4 }" data-color="#87B87F"><span class="percent">${a4 }</span>%</div><span class="name">书画类</span></div>
   <div class="proportion"> <div class="easy-pie-chart percentage" data-percent="${a5 }" data-color="#d63116"><span class="percent">${a5 }</span>%</div><span class="name">玉石类</span></div>
   <div class="proportion"> <div class="easy-pie-chart percentage" data-percent="${a6 }" data-color="#d63116"><span class="percent">${a6 }</span>%</div><span class="name">古玩类</span></div>
   <div class="proportion"> <div class="easy-pie-chart percentage" data-percent="${a7 }" data-color="#d63116"><span class="percent">${a7 }</span>%</div><span class="name">电玩类</span></div>
 </div>
 </div>
     <!--订单列表-->
     <div class="Order_form clearfix" id="table_order_list">
      <form action="./a_transferServlet" method="post">
      <div class="search_style">
      <div class="title_names">搜索查询</div>
      <ul class="search_content clearfix">
       <li><label class="l_f">订单编号</label><input name="transfer_id" type="text" class="text_add" placeholder="订单编号" style=" width:250px" /></li>
       <li><label class="l_f">时间</label><input name="transfer_date" class="inline laydate-icon" id="start" style=" margin-left:10px;" /></li>
       <li style="width:90px;"><button type="submit" class="btn_search"><i class="fa fa-search"></i>查询</button></li>
      </ul>
    </div>
    </form>
    <form id="pageIndexFrom" action="./a_transferServlet" method="post">
    	<div>每页显示条数:&nbsp;&nbsp;&nbsp;&nbsp;
	    <select style="width: 4%" id="seleIndex" name="pageSize" onchange="changepageSize()">
	    	<option>3</option>
	    	<option>5</option>
	    	<option>10</option>
	    </select>
    </div>
    <br />
     <!--订单列表展示-->
       <table class="table table-striped table-bordered table-hover" id="sample-table">
		<thead>
		 <tr>
				<th width="25px"><label><input type="checkbox" class="ace" id="checkAll"/><span class="lbl"></span></label></th>
				<th width="120px">订单编号</th>
				<th width="120px">转出者</th>
				<th width="120px">转出金额</th>
				<th width="120px">手续费</th>
                <th width="120px">转入者</th>				
				<th width="120px">转入金额</th>
                <th width="100px">商品名称</th>
				<th width="200px">交易时间</th>                
				<th width="80px">操作</th>
			</tr>
		</thead>
		<!-- <tbody id="tbody"></tbody>
        <tfoot id="template" style="display: none;"> -->
        <tbody>
        <c:if test="${pageBean.list!=null && pageBean.list.size()>0}">
    			<c:forEach items="${pageBean.list}" var="transfer" varStatus="s">
        	<tr align   +="center" class="d">
	             <td><input type="checkbox" value="" name="typeId" class="ch"/></td>
	             <td class="transfer_id">${transfer.transfer_id }</td>
	             <td>${transfer.customerList[0].customer_name }</td>
	             <td>${transfer.amount_out }</td>
	             <td>${transfer.poundage }</td>
	             <td>${transfer.customerList[1].customer_name }</td>
	             <td>${transfer.amount_in }</td>
	             <td>${transfer.goods.goods_name }</td>
	             <td>${transfer.transfer_date }</td>
			     <td>
			     	<a title="删除" href="a_transferServlet?opr=del&transfer_id=${transfer.transfer_id }" onclick="return confirm('你确定要删除吗?')" class="btn btn-xs btn-warning" ><i class="fa fa-trash  bigger-120"></i></a>    
			     </td>
    		</tr>
    			</c:forEach>
    		</c:if>
    		</tbody>
       <!-- </tfoot> -->
     </table><br />
     
     	 <!-- <input type="hidden" name="pageIndex" id="pageIndexs"/>
	     <div style="width: 550px; margin: 0 auto;">
	    	当前<span id="pageIndex1">{pageIndex}</span>/<span id="pageCount1">{pageCount}</span>页，
	    	每页显示<span id="pageSize1">{pageSize}</span>条记录，共<span id="totalCount1">{totalCount}</span>条记录&nbsp;&nbsp;
	  		<button type="button" onclick="shouye()" class="btn btn-xs btn-warning" >首页</button>
	  		<button type="button" onclick="shangyiye()" class="btn btn-xs btn-success">上一页</button>
	  		<button type="button" onclick="xiayiye()"  class="btn btn-xs btn-info order_detailed">下一页</button>
	  		<button type="button" onclick="moye()" class="btn btn-xs btn-warning" >末页</button>
	  	</div> -->
	  	
	  	 <div style="width: 550px; margin: 0 auto;">
	    	当前${pageBean.pageIndex }/${pageBean.pageCount }页，
	    	每页显示${pageBean.pageSize }条记录，共${pageBean.totalCount }条记录&nbsp;&nbsp;
	  		<a href="a_transferServlet?pageIndex=1" onclick="return ${pageBean.pageIndex!=1}" class="btn btn-xs btn-warning">首页</a>&nbsp;&nbsp;
	  		<a href="a_transferServlet?pageIndex=${pageBean.pageIndex-1 }" onclick="return ${pageBean.pageIndex>0}" class="btn btn-xs btn-success">上一页</a>&nbsp;&nbsp;
	  		<a href="a_transferServlet?pageIndex=${pageBean.pageIndex+1 }" onclick="return ${pageBean.pageIndex<pageBean.pageCount}" class="btn btn-xs btn-success">下一页</a>&nbsp;&nbsp;
	  		<a href="a_transferServlet?pageIndex=${pageBean.pageCount }" onclick="return ${pageBean.pageIndex!=pageBean.pageCount}" class="btn btn-xs btn-warning">末页</a>&nbsp;&nbsp;
  		</div>
	  </form>
   </div>
  </div>
 <!--发货-->
 <div id="Delivery_stop" style=" display:none">
  <div class="">
    <div class="content_style">
  <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">快递公司 </label>
       <div class="col-sm-9"><select class="form-control" id="form-field-select-1">
																<option value="">--选择快递--</option>
																<option value="1">天天快递</option>
																<option value="2">圆通快递</option>
																<option value="3">中通快递</option>
																<option value="4">顺丰快递</option>
																<option value="5">申通快递</option>
																<option value="6">邮政EMS</option>
																<option value="7">邮政小包</option>
																<option value="8">韵达快递</option>
															</select></div>
	</div>
   <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 快递号 </label>
    <div class="col-sm-9"><input type="text" id="form-field-1" placeholder="快递号" class="col-xs-10 col-sm-5" style="margin-left:0px;"></div>
	</div>
    <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">货到付款 </label>
     <div class="col-sm-9"><label><input name="checkbox" type="checkbox" class="ace" id="checkbox"><span class="lbl"></span></label></div>
	</div>
 </div>
  </div>
 </div>
</body>
</html>
<script>
//左侧显示隐藏
$(function() { 
	$("#order_list").fix({
		float : 'left',
		//minStatue : true,
		skin : 'green',	
		durationTime :false,
		spacingw:50,//设置隐藏时的距离
	    spacingh:270,//设置显示时间距
		close_btn:'.close_btn',
		show_btn:'.show_btn',
		side_list:'.side_list',
	});
});
//顶部隐藏显示
$(function() { 
	$("#Order_form_style").fix({
		float : 'top',
		//minStatue : true,
		skin : 'green',	
		durationTime :true,
		spacingw:0,
		spacingh:0,
		close_btn:'.top_close_btn',
		show_btn:'.top_show_btn',
		side_list:'.hide_style',
		close_btn_width:80,
		side_title:'.Statistic_title',
	});
});
//时间选择
 laydate({
    elem: '#start',
    event: 'focus' 
});
/*订单-删除*/
function Order_form_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}
/**发货**/
function Delivery_stop(obj,id){
	layer.open({
        type: 1,
        title: '发货',
		maxmin: true, 
		shadeClose:false,
        area : ['500px' , ''],
        content:$('#Delivery_stop'),
		btn:['确定','取消'],
		yes: function(index, layero){		
		if($('#form-field-1').val()==""){
			layer.alert('快递号不能为空！',{
               title: '提示框',				
			  icon:0,		
			  }) 
			
			}else{			
			 layer.confirm('提交成功！',function(index){
		$(obj).parents("tr").find(".td-manage").prepend('<a style=" display:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="已发货"><i class="fa fa-cubes bigger-120"></i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发货</span>');
		$(obj).remove();
		layer.msg('已发货!',{icon: 6,time:1000});
			});  
			layer.close(index);    		  
		  }
		
		}
	})
};
//面包屑返回值
var index = parent.layer.getFrameIndex(window.name);
parent.layer.iframeAuto(index);
$('.Order_form,.order_detailed').on('click', function(){
	var cname = $(this).attr("title");
	var chref = $(this).attr("href");
	var cnames = parent.$('.Current_page').html();
	var herf = parent.$("#iframe").attr("src");
    parent.$('#parentIframe').html(cname);
    parent.$('#iframe').attr("src",chref).ready();;
	parent.$('#parentIframe').css("display","inline-block");
	parent.$('.Current_page').attr({"name":herf,"href":"javascript:void(0)"}).css({"color":"#4c8fbd","cursor":"pointer"});
	//parent.$('.Current_page').html("<a href='javascript:void(0)' name="+herf+" class='iframeurl'>" + cnames + "</a>");
    parent.layer.close(index);
	
});

//初始化宽度、高度
$(".hide_style").height($(".hide_style").height()); 
 var heights=$(".hide_style").outerHeight(true)+90;  
 $(".widget-box").height($(window).height()-heights); 
$(".table_menu_list").width($(window).width()-250);
 $(".table_menu_list").height($(window).height()-heights);
  //当文档窗口发生改变时 触发  
    $(window).resize(function(){
	$(".widget-box").height($(window).height()-heights);
	 $(".table_menu_list").width($(window).width()-250);
	  $(".table_menu_list").height($(window).height()-heights);
	})
//比例
var oldie = /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase());
			$('.easy-pie-chart.percentage').each(function(){
				$(this).easyPieChart({
					barColor: $(this).data('color'),
					trackColor: '#EEEEEE',
					scaleColor: false,
					lineCap: 'butt',
					lineWidth: 10,
					animate: oldie ? false : 1000,
					size:103
				}).css('color', $(this).data('color'));
			});
		
			$('[data-rel=tooltip]').tooltip();
			$('[data-rel=popover]').popover({html:true});
</script>
<script>
//订单列表
/* jQuery(function($) {
		var oTable1 = $('#sample-table').dataTable( {
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,1,2,3,4,5,6,7,8,9]}// 制定列不参与排序
		] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
			
				$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('table')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			}); */
</script>
